package com.wtf.dsp.admin.model.dto;

import com.wtf.dsp.core.enums.SqlResponseMapper;
import com.wtf.dsp.core.enums.SqlType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Map;

/**
 * ClassName: NsUpdateDTO
 * Description:
 * date: 2023/7/7 17:56
 *
 * @author linhuanyou
 * @version 1.0
 */
@Data
@ToString
@ApiModel("SQL测试请求类")
public class SqlTestDTO {
    @ApiModelProperty(value = "命名空间")
    @Length(min = 0,max = 20,message = "请输入不超过20个字符")
    @Pattern(regexp = "^[-a-zA-Z0-9]+$",message = "请输入英文、数字、-的字符的命名空间")
    @NotBlank(message = "请输入命名空间")
    private String ns;
    @ApiModelProperty(value = "数据源")
    @Length(min = 0,max = 20,message = "请输入不超过20个字符")
    @Pattern(regexp = "^[-a-zA-Z0-9]+$",message = "请输入英文、数字、-的字符的数据源")
    @NotBlank(message = "请输入数据源")
    private String ds;
    @ApiModelProperty(value = "Mapper名称空间")
    @Length(min = 0,max = 50,message = "请输入不超过50个字符")
    @Pattern(regexp = "^[a-zA-Z0-9]+$",message = "请输入英文、数字的字符的Mapper名称空间")
    @NotBlank(message = "请输入Mapper名称空间")
    private String mns;
    @ApiModelProperty(value = "SQL标识")
    @Length(min = 0,max = 100,message = "请输入不超过100个字符")
    @Pattern(regexp = "^[a-zA-Z0-9]+$",message = "请输入英文、数字的字符的SQL_ID")
    @NotBlank(message = "请输入SQL标识")
    private String sqlId;
    @ApiModelProperty(value = "SQL类型")
    @NotNull(message = "SQL类型")
    private SqlType sqlType;
    @ApiModelProperty(value = "SQL语句")
    @NotBlank(message = "请输入SQL语句")
    private String sqlStatement;
    /**SQL响应类型*/
    @ApiModelProperty(value = "SQL响应类型")
    @NotNull(message = "SQL响应类型")
    private SqlResponseMapper sqlResponseMapper;
    @ApiModelProperty(value = "参数集")
    private Map<String,Object> params;
    /**分页页码*/
    @ApiModelProperty(value = "分页页码")
    private Integer page;
    /**分页条数*/
    @ApiModelProperty(value = "分页条数")
    private Integer limit;
}
